/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package model.impl;

import java.util.Collection;

import model.ModelPackage;
import model.OtherSerie;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Other Serie</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link model.impl.OtherSerieImpl#getPaper <em>Paper</em>}</li>
 *   <li>{@link model.impl.OtherSerieImpl#getPeriod <em>Period</em>}</li>
 *   <li>{@link model.impl.OtherSerieImpl#getNumberOfEpisodes <em>Number Of Episodes</em>}</li>
 *   <li>{@link model.impl.OtherSerieImpl#getSeasons <em>Seasons</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class OtherSerieImpl extends EntityImpl implements OtherSerie {
	/**
	 * The default value of the '{@link #getPaper() <em>Paper</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPaper()
	 * @generated
	 * @ordered
	 */
	protected static final String PAPER_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getPaper() <em>Paper</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPaper()
	 * @generated
	 * @ordered
	 */
	protected String paper = PAPER_EDEFAULT;

	/**
	 * The cached value of the '{@link #getPeriod() <em>Period</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPeriod()
	 * @generated
	 * @ordered
	 */
	protected EList<Integer> period;

	/**
	 * The default value of the '{@link #getNumberOfEpisodes() <em>Number Of Episodes</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfEpisodes()
	 * @generated
	 * @ordered
	 */
	protected static final Integer NUMBER_OF_EPISODES_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getNumberOfEpisodes() <em>Number Of Episodes</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberOfEpisodes()
	 * @generated
	 * @ordered
	 */
	protected Integer numberOfEpisodes = NUMBER_OF_EPISODES_EDEFAULT;

	/**
	 * The cached value of the '{@link #getSeasons() <em>Seasons</em>}' attribute list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSeasons()
	 * @generated
	 * @ordered
	 */
	protected EList<Integer> seasons;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected OtherSerieImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.OTHER_SERIE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getPaper() {
		return paper;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPaper(String newPaper) {
		String oldPaper = paper;
		paper = newPaper;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.OTHER_SERIE__PAPER, oldPaper, paper));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Integer> getPeriod() {
		if (period == null) {
			period = new EDataTypeUniqueEList<Integer>(Integer.class, this, ModelPackage.OTHER_SERIE__PERIOD);
		}
		return period;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Integer getNumberOfEpisodes() {
		return numberOfEpisodes;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberOfEpisodes(Integer newNumberOfEpisodes) {
		Integer oldNumberOfEpisodes = numberOfEpisodes;
		numberOfEpisodes = newNumberOfEpisodes;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.OTHER_SERIE__NUMBER_OF_EPISODES, oldNumberOfEpisodes, numberOfEpisodes));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Integer> getSeasons() {
		if (seasons == null) {
			seasons = new EDataTypeUniqueEList<Integer>(Integer.class, this, ModelPackage.OTHER_SERIE__SEASONS);
		}
		return seasons;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.OTHER_SERIE__PAPER:
				return getPaper();
			case ModelPackage.OTHER_SERIE__PERIOD:
				return getPeriod();
			case ModelPackage.OTHER_SERIE__NUMBER_OF_EPISODES:
				return getNumberOfEpisodes();
			case ModelPackage.OTHER_SERIE__SEASONS:
				return getSeasons();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.OTHER_SERIE__PAPER:
				setPaper((String)newValue);
				return;
			case ModelPackage.OTHER_SERIE__PERIOD:
				getPeriod().clear();
				getPeriod().addAll((Collection<? extends Integer>)newValue);
				return;
			case ModelPackage.OTHER_SERIE__NUMBER_OF_EPISODES:
				setNumberOfEpisodes((Integer)newValue);
				return;
			case ModelPackage.OTHER_SERIE__SEASONS:
				getSeasons().clear();
				getSeasons().addAll((Collection<? extends Integer>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.OTHER_SERIE__PAPER:
				setPaper(PAPER_EDEFAULT);
				return;
			case ModelPackage.OTHER_SERIE__PERIOD:
				getPeriod().clear();
				return;
			case ModelPackage.OTHER_SERIE__NUMBER_OF_EPISODES:
				setNumberOfEpisodes(NUMBER_OF_EPISODES_EDEFAULT);
				return;
			case ModelPackage.OTHER_SERIE__SEASONS:
				getSeasons().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.OTHER_SERIE__PAPER:
				return PAPER_EDEFAULT == null ? paper != null : !PAPER_EDEFAULT.equals(paper);
			case ModelPackage.OTHER_SERIE__PERIOD:
				return period != null && !period.isEmpty();
			case ModelPackage.OTHER_SERIE__NUMBER_OF_EPISODES:
				return NUMBER_OF_EPISODES_EDEFAULT == null ? numberOfEpisodes != null : !NUMBER_OF_EPISODES_EDEFAULT.equals(numberOfEpisodes);
			case ModelPackage.OTHER_SERIE__SEASONS:
				return seasons != null && !seasons.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (paper: ");
		result.append(paper);
		result.append(", period: ");
		result.append(period);
		result.append(", numberOfEpisodes: ");
		result.append(numberOfEpisodes);
		result.append(", seasons: ");
		result.append(seasons);
		result.append(')');
		return result.toString();
	}

} //OtherSerieImpl
